package com.giaothong.database;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.util.Log;
public class IndexTabDAL {
	private Context context;
	public static final int INDEX_TAB_MODE =  Context.MODE_PRIVATE;
	public static final String INDEX_TAB_NAME = "prefHomeName";
	public static final String INDEX_CURRENT_TAB = "setIndexCurrentTab";
	private final String TAG = "IndexTabDAL";
	
	public IndexTabDAL(Context context){
		this.context = context;
	}
		
	public int getIndexCurrentTab(){
		//Log.i(TAG,"getIndexCurrentTab");
		SharedPreferences pref = this.context.getSharedPreferences(INDEX_TAB_NAME, INDEX_TAB_MODE);
		return pref.getInt(INDEX_CURRENT_TAB, 0);
	}
	public Editor getEditor(){
		//Log.i(TAG,"getEditor");
		return this.context.getSharedPreferences(INDEX_TAB_NAME, INDEX_TAB_MODE).edit();
	}
	public Boolean setIndexCurrentTab(int index){
		Log.i(TAG,"setIndexCurrentTab");
		Editor editor = getEditor();
		editor.putInt(INDEX_CURRENT_TAB, index);
		return editor.commit();
	}
}
